import Page
from Page import Carpark
from Base.Base import Base
from selenium.webdriver.common.by import By


class CarparkDialectQuitToastPage(Base):
    """
    车乐汇猜方言退出弹窗

    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 弹窗标题
        self.quit_title_text = (By.XPATH, Carpark.RESOURCE_ID_Dialect.format("title"))

        # 弹窗内容
        self.quit_connect_text = (By.XPATH, Carpark.RESOURCE_ID_Dialect.format("tv_msg"))

        # 确认按钮
        self.quit_ok_btn = (By.XPATH, Carpark.RESOURCE_ID_Dialect.format("sure"))

        # 取消按钮
        self.quit_no_btn = (By.XPATH, Carpark.RESOURCE_ID_Dialect.format("cancel"))

    def get_title(self):
        """
         获取弹窗标题

         :return:获取元素
         """
        return self.find_element_o(self.quit_title_text)

    def get_connect(self):
        """
         获取弹窗内容

         :return:获取元素
         """
        return self.find_element_o(self.quit_connect_text)

    def click_ok(self):
        """
         点击确认按钮

         :return:None
         """
        self.click_element(self.quit_ok_btn)

    def click_no(self):
        """
         点击取消按钮

         :return:None
         """
        self.click_element(self.quit_no_btn)

    def is_display_carpark_quit_toast(self):
        """
        查看是否进入猜方言退出弹窗

        :return:
        """
        return self.is_display(self.quit_title_text)
